
package org.japril.swing.jutil.logging;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JDialog;

@SuppressWarnings("serial")
public final class ControlLogSinksDialog extends JDialog 
{
  /**
   * <p>
   *   Constructor.
   * </p>
   */
  public ControlLogSinksDialog(){ buildGui(); }
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param p Dialog's parent.
   */
  public ControlLogSinksDialog(Dialog p){ super(p); buildGui(); }
  
  /**
   * <p>
   *   Constructor.
   * </p>
   * @param p Dialog's parent.
   */
  public ControlLogSinksDialog(Frame p){ super(p); buildGui(); }
  
  private void buildGui()
  {
    setTitle("Log Configurations");
    setModal(true);
    
    Container c=getContentPane();
    c.setLayout(new BorderLayout());
    
    ControlLogSinksPanel panel=new ControlLogSinksPanel(m_closeAction);
    c.add(panel, BorderLayout.CENTER);
    
    pack();
  }
  
  private Action m_closeAction=new AbstractAction("Close")
  {
    public void actionPerformed(ActionEvent e){ dispose(); }
  };
  
  /**
   * <p>
   *   Shows dialog.
   * </p>
   */
  public void showDialog(){ setVisible(true); }
  
}
